package com.ruiao.tools.fenbiao;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.text.Html;
import android.widget.TextView;

import com.loopj.android.http.RequestParams;
import com.ruiao.tools.R;
import com.ruiao.tools.url.URLConstants;
import com.ruiao.tools.utils.HttpUtil;
import com.ruiao.tools.utils.StatusBarUtil;

import org.json.JSONException;
import org.json.JSONObject;

import butterknife.BindView;
import butterknife.ButterKnife;
import cz.msebera.android.httpclient.Header;

import static com.baidu.mapapi.BMapManager.getContext;

public class GongyiliuchengActivity extends AppCompatActivity {
    public String id = "";
    @BindView(R.id.tv)
    TextView tv;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gongsiliucheng);
        ButterKnife.bind(this);
        StatusBarUtil.darkMode(this);
        id = getIntent().getStringExtra("id");
        upData();

    }
    public void upData() {
        RequestParams pa = new RequestParams();
        pa.add("id", id);
        HttpUtil.get(URLConstants.FenbiaoYichangyiCe, pa, new HttpUtil.SimpJsonHandle(getContext()) {
            @Override
            public void onStart() {
                super.onStart();

            }

            @Override
            public void onFinish() {
                super.onFinish();

            }

            @Override
            public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
                super.onSuccess(statusCode, headers, response);

                try {
                    if (response.getString("success").equals("true")) {
                        String gongshi = response.getString("gongshi");
                        tv.setText(Html.fromHtml(gongshi));
                    } else {

                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }

            }
        });
    }
}
